package top.laoshuzi.designpatterns.base.behavior.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * 结构对象
 */
public class ObjectStructure {

    private List<Node> nodes = new ArrayList<>();

    public void add(Node node) {
        nodes.add(node);
    }

    public void remvoe(Node node) {
        nodes.remove(node);
    }

    public void action(Visitor visitor) {
        for (Node node : nodes) {
            node.accept(visitor);
        }
    }

}
